package org.mikeliu.review.exp4;

import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		double a,b,c;
		Shape x;
		String str;
		String []s;
		while(scanner.hasNextLine())
		{
			str = scanner.nextLine();
			s = str.split(" ");
			if(s.length==1)
			{
				a = Double.parseDouble(s[0]);
				x = new Circle(a);
				System.out.printf("%.2f\n",x.length());
			}
			else if(s.length==2)
			{
				a = Double.parseDouble(s[0]);
				b = Double.parseDouble(s[1]);
				x = new Rectangle(a,b);
				System.out.printf("%.2f\n",x.length());
			}
			else if(s.length==3)
			{
				a = Double.parseDouble(s[0]);
				b = Double.parseDouble(s[1]);
				c = Double.parseDouble(s[2]);
				x = new Triangle(a,b,c);
				System.out.printf("%.2f\n",x.length());
			}
		}
		scanner.close();
	}
}
 
interface Shape
{
	public double length();
}
 
class Triangle implements Shape
{
	double a,b,c;
	Triangle(double a,double b,double c)
	{
		this.a = a;
		this.b = b;
		this.c = c;
	}
	public double length()
	{
		if(a<=0||b<=0||c<=0)
			return 0;
		if(a+b<=c||a+c<=b||b+c<=a)
			return 0;
		return a + b + c;
	}
}
 
class Rectangle implements Shape
{
	double a,b;
	Rectangle(double a,double b)
	{
		this.a = a;
		this.b = b;
	}
	public double length()
	{
		if(a<=0||b<=0)
			return 0;
		return (a + b) * 2;
	}
}
 
class Circle implements Shape
{
	double a;
	Circle(double a)
	{
		this.a = a;
	}
	public double length()
	{
		if(a<=0)
			return 0;
		return a * 3.14 * 2;
	}
} 